package com.translate.web.api.service.impl;

import com.translate.web.api.domain.MgOrderNodeRecord;
import com.translate.web.api.mapper.MgOrderNodeRecordMapper;
import com.translate.web.api.service.IMgOrderNodeRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * 科腾订单操作节点信息记录Service业务层处理
 *
 * @author ruoyi
 * @date 2024-02-22
 */
@Service
public class MgOrderNodeRecordServiceImpl implements IMgOrderNodeRecordService {


    @Resource
    private MgOrderNodeRecordMapper mgOrderNodeRecordMapper;
    /**
     * 保存订单节点信息
     * @param orderId
     * @param recordCode
     * @param recordName
     * @param nodeDescribe
     */
    @Override
    public void saveOrderNodeRecord(Integer orderId, String recordCode, String recordName, String nodeDescribe) {
        MgOrderNodeRecord mgOrderNodeRecord = new MgOrderNodeRecord();
        mgOrderNodeRecord.setOrderId(orderId);
        mgOrderNodeRecord.setRecordCode(recordCode);
        mgOrderNodeRecord.setRecordName(recordName);
        mgOrderNodeRecord.setRecordTime(new Date());
        mgOrderNodeRecord.setNodeDescribe(nodeDescribe);
        mgOrderNodeRecord.setCreateTime(new Date());
        mgOrderNodeRecordMapper.insert(mgOrderNodeRecord);
    }

    /**
     * 通过订单id查询订单时间轴信息
     * @param orderId
     * @return
     */
    @Override
    public List<MgOrderNodeRecord> selectByOrderId(Integer orderId) {
        return mgOrderNodeRecordMapper.selectByOrderId(orderId);
    }
}
